﻿using System;
using System.Runtime.Serialization;
using NCMIS.ObjectModel.MetaData;

namespace NCMIS.AccessControl
{
    /// <summary>
    /// Represents an Access Control Entry (ACE).
    /// </summary>
    [DataContract(Namespace = CmisNs.Cmis)]
    public class AccessControlEntry
    {
        /// <summary>
        /// Array of <see cref="System.String"/> with the names of the permissions.
        /// </summary>
        [DataMember(Name = "permission")]
        public string[] Permissions { get; set; }

        /// <summary>
        /// The user management object, e.g. a user, group, or role.
        /// </summary>
        [DataMember(Name = "principal")]
        public AccessControlPrincipal Principal
        {
            get;
            set;
        }

        /// <summary>
        /// Flag indicating whether the ACE is directly assigned to the object (if true) or somehow derived (if false).
        /// </summary>
        [DataMember(Name = "direct")]
        public bool Direct
        {
            get;
            set;
        }
    }
}
